package com.example.basic_config.controller;

import com.example.basic_config.pojo.MyObj;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author ljw
 * @description
 * @date 2021/9/2 7:50
 */
@Controller
public class MyController {

    @RequestMapping("/advice")
    public String getSomething(@ModelAttribute("msg") String msg, MyObj myObj) {
        System.out.println("前端参数 myObj:" + myObj.toString());
        throw new RuntimeException("参数有误，初始化的参数msg: "+msg);
    }

    @RequestMapping("/advice1")
    public String getSomething1(@ModelAttribute("msg") String msg, MyObj myObj) {
        System.out.println("前端参数 myObj:" + myObj.toString());
        return "success";
    }
}
